﻿/*
 * Created by SharpDevelop.
 * User: chasanek
 * Date: 05-4-2011
 * Time: 9:49
 * 
 */
using System;
using System.Drawing;
using System.Windows.Forms;


namespace legends
{
	
	
	/// <summary>
	/// Description of Form2.
	/// </summary>
	public partial class GameForm : Form
	{
		
		public GameForm(GameConstants gameCon, Game game)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();		
			InitializeGameInfo(game);
            
			//
			// Creating gameplay constants class for this form. Can be changed in setting
			//			
			GameConstants gameConstants = gameCon;			
			//
			// Changing resolution according to computers resolution
			//
			this.ClientSize = new System.Drawing.Size(gameConstants.getResWidth(),gameConstants.getResHeight());
			MapPictureBox.Size= new Size(Convert.ToInt32(gameConstants.getResWidth()/1.35),Convert.ToInt32(gameConstants.getResHeight()/1.3));
			GameInfoPanel.Left=Convert.ToInt32(gameConstants.getResWidth()/1.17);
            ConsoleListBox.Top = Convert.ToInt32(gameConstants.getResHeight() / 1.18);
            ConsoleListBox.Size = new Size(Convert.ToInt32(gameConstants.getResWidth() / 1.05), Convert.ToInt32(gameConstants.getResHeight() / 9));
		}
       


        public class Map
        {
            private int rows;					//ammount of rows
            private int cols;					//ammount of columns
            // world v konstruktoru bude zmeneny na tridu world ktera bude obsahovat mapu celyho sveta, dale bude v konstruktoru parametr game, ze kteryho si vytahneme promenny ktery nam urci ktera cast mapy je zrovna zobrazena
            private Tile[,] data;				//contains all tiles
            private Tile selected;				//contains tile which is currently selected
            public Map(int rows, int cols, int world)
            {
                this.rows = rows;
                this.cols = cols;
            }


            public void DrawMap()
            {


            }
        }
		// Keyboard handler
		private void GameForm_keyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			e.Handled = true;

		}
		
			private void MapPictureBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
			{
    		// Create a local version of the graphics object for the PictureBox.
    		Graphics g = e.Graphics;

    		// Draw a string on the PictureBox.
    		g.DrawString("This is a diagonal line drawn on the control", new Font("Arial",10), System.Drawing.Brushes.Blue, new Point(30,30));
    		// Draw a line in the PictureBox.
    		g.DrawLine(System.Drawing.Pens.Red, MapPictureBox.Left, MapPictureBox.Top, MapPictureBox.Right, MapPictureBox.Bottom);
			}
		
/*		protected override void OnPaint(PaintEventArgs e) {
    Bitmap bmp = new Bitmap(100, 100);
    Graphics gImage = Graphics.FromImage(bmp);
    gImage.FillRectangle(Brushes.Red, 0, 0, bmp.Width, bmp.Height);
    gImage.DrawRectangle(Pens.Black, 10, 10, bmp.Width - 20, bmp.Height - 20);  
			

			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
			
		}
*/
		
		void Button1Click(object sender, EventArgs e)
		{
			this.Dispose();
			Application.Exit();
		}
		
		
		void InitializeGameInfo(Game game)
		{
			PartyInfoLabel.Text="Player name:  "+ game.getName()+ "\n" +
            "Gold: " +game.getGold()+ "\n\n" +
            "Reputation: " +game.getReputation()+"\n" +
            "Party leader: " +game.getHeroes().ToString();
		}
		void GameFormLoad(object sender, EventArgs e)
		{
			
		}
		
        private void GameForm_KeyDown_1(object sender, KeyEventArgs e)
        {
            PartyInfoLabel.Text = e.KeyData.ToString();
        }
	}
}
